package com.linkoog.devtools.code_generator.util;

import org.apache.commons.lang3.StringUtils;

public class BooleanUtils {

    public static Boolean parse(String value){
        if (StringUtils.isBlank(value)){
            return null;
        }

        if ("NULL".equalsIgnoreCase(value)){
            return null;
        }else if ("FALSE".equalsIgnoreCase(value)
                || "NO".equalsIgnoreCase(value)){
            return Boolean.FALSE;
        } else if ("TRUE".equalsIgnoreCase(value)
                || "YES".equalsIgnoreCase(value)
                || "OK".equalsIgnoreCase(value)){
            return Boolean.TRUE;
        }
        return null;
    }
}
